package en.edu.zucc.pb.loginapplication.fragment;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.util.Log;

import en.edu.zucc.pb.loginapplication.R;
import en.edu.zucc.pb.loginapplication.common.Commons;

/**
 *配置页面
 */
public class SettingFragment extends PreferenceFragment {


    private static final String TAG = "SettingFragment";

//    这个是 没有把之前的content换掉
//    而是多了一层
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.addPreferencesFromResource(R.xml.preference);

//        boolean silentMode = preferences.getBoolean("silent_mode" , false);
//        boolean awesomeMode = preferences.getBoolean("awesome_mode", false);
//        String string = preferences.getString("custom_storage", "");

        Activity activity = getActivity();
        //获取配置值
        PreferenceManager.setDefaultValues(activity , R.xml.preference , false);
        SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(activity);

//————————————————
//        版权声明：本文为CSDN博主「康耶」的原创文章，遵循CC 4.0 BY-SA版权协议，转载请附上原文出处链接及本声明。
//        原文链接：https://blog.csdn.net/qwer492915298/article/details/88063854

        boolean shakeIt = pref.getBoolean(Commons.SHAKE_IT, false);
        Log.i(TAG, "shakeIt read "+shakeIt);
        boolean NIGHT_MODE = pref.getBoolean(Commons.NIGHT_MODE, false);
        Log.i(TAG, "NIGHT_MODE read "+NIGHT_MODE);
        boolean daily_bookkeeping_reminder =
                pref.getBoolean(Commons.daily_bookkeeping_reminder, false);
        Log.i(TAG, "daily_bookkeeping_reminder read "+daily_bookkeeping_reminder);


//————————————————
//        版权声明：本文为CSDN博主「康耶」的原创文章，遵循CC 4.0 BY-SA版权协议，转载请附上原文出处链接及本声明。
//        原文链接：https://blog.csdn.net/qwer492915298/article/details/88063854

    }
 
 
 
 
}